using UnityEngine;

public class BounceBullet : Bullet
{
	[SerializeField]
	private int bounceCount;

	protected override void FixedUpdate()
	{
	}

	private void LateUpdate()
	{
		Vector3 velocity = base.body.velocity.normalized * speed;
		base.body.velocity = velocity;
	}

	protected override void OnCollisionEnter(Collision collision)
	{
		bounceCount--;
		if (bounceCount <= 0)
		{
			UnityEngine.Object.Destroy(base.gameObject);
		}
		else if ((bool)collision.rigidbody)
		{
			Rigidbody rigidbody = collision.rigidbody;
			CharacterPart component = rigidbody.GetComponent<CharacterPart>();
			BombCrate component2 = rigidbody.GetComponent<BombCrate>();
			if (component != null)
			{
				int num = 15;
				Vector3 force = num * base.transform.forward * 100f;
				component.TakeDamage(damage, shooter, force);
				UnityEngine.Object.Destroy(base.gameObject);
			}
			else if (component2 != null)
			{
				component2.Blow(shooter);
			}
		}
	}
}
